import server from '@/utils/http';
import { Pagination, PaginationQuery } from '@/types/table';

enum Api {
    cetegory = '/api/skuSpecs',
    skuDict = '/api/skuDict',
    skuGoodsSku = '/api/skuGoodsSku',
    skuPriceChange = '/api/skuPriceChange',
    queuePage = '/api/queue/page',
    skuDictChange = '/api/skuDict/change',
}

/**
 * @description 获取分类列表
 * @param page 页码
 * @param size pageSize
 * @sort 排序方式 默认level,asc
 * @return { content: 列表, totalElements： 总数 }
 */
export const getCetegory = (query?: Pagination): Promise<mqList> => {
    return server.Get(Api.cetegory, query);
};

/**
 *
 * @description 新增分类
 * @param addMQ info
 */
export const addCetegory = (params: NormalObj): Promise<void> => {
    return server.Post(Api.cetegory, params);
};
/**
 *
 * @description 编辑分类
 * @param editType info
 */
export const editCetegory = (params: NormalObj): Promise<void> => {
    return server.Put(Api.cetegory, params);
};
/**
 *
 * @description 删除分类
 * @param ids 分类id
 */
export const deleteCetegory = (params: (string | number)[]): Promise<void> => {
    return server.Delete(Api.cetegory, { data: params });
};

/**
 * @description 查询商品字典
 */
export const getSkuDict = (query?: any): Promise<any> => {
    return server.Get(Api.skuDict, query);
};

/**
 * @description 新增商品字典
 */
export const addSkuDict = (params: NormalObj): Promise<void> => {
    return server.Post(Api.skuDict, params);
};
/**
 *
 * @description 修改商品字典
 * @param editType info
 */
export const editSkuDict = (params: NormalObj): Promise<void> => {
    return server.Put(Api.skuDict, params);
};
/**
 *
 * @description 删除商品字典
 * @param ids 分类id
 */
export const deleteSkuDict = (params: (string | number)[]): Promise<void> => {
    return server.Delete(Api.skuDict, { data: params });
};

/**
 * @description 获取分类列表
 * @param page 页码
 * @param size pageSize
 * @sort 排序方式 默认level,asc
 * @return { content: 列表, totalElements： 总数 }
 */
export const getskuGoodsSku = (query: PaginationQuery): Promise<TableResponse> => {
    return server.Get(Api.skuGoodsSku, query);
};

/**
 * @description 新增商品
 */
export const addskuGoodsSku = (params: NormalObj): Promise<void> => {
    return server.Post(Api.skuGoodsSku, params);
};

/**
 * @description 修改商品
 */
export const putskuGoodsSku = (params: NormalObj): Promise<void> => {
    return server.Put(Api.skuGoodsSku, params);
};

/**
 *
 * @description 删除商品
 * @param ids 分类id
 */
export const deleteskuGoodsSku = (params: (string | number)[]): Promise<void> => {
    return server.Delete(Api.skuGoodsSku, { data: params });
};

/**
 * @description 获取分类列表
 * @param page 页码
 * @param size pageSize
 * @sort 排序方式 默认level,asc
 * @return { content: 列表, totalElements： 总数 }
 */
export const getskuPriceChange = (query?: Pagination): Promise<TableResponse> => {
    return server.Get(Api.skuPriceChange, query);
};

/**
 * @description 新增商品变价
 */
export const addskuPriceChange = (params: NormalObj): Promise<void> => {
    return server.Post(Api.skuPriceChange, params);
};

/**
 * @description 新增商品变价
 */
export const putskuPriceChange = (params: NormalObj): Promise<void> => {
    return server.Put(Api.skuPriceChange, params);
};
/**
 *
 * @description 删除分类
 * @param ids 分类id
 */
export const deleteskuPriceChange = (params: (string | number)[]): Promise<void> => {
    return server.Delete(Api.skuPriceChange, { data: params });
};

/**
 * @description 获取下发队列列表
 * @param page 页码
 * @param size pageSize
 * @sort 排序方式 默认level,asc
 * @return { content: 列表, totalElements： 总数 }
 */
export const getQueuePage = (query?: PaginationQuery): Promise<TableResponse> => {
    return server.Get(Api.queuePage, query);
};

/**
 * @description 改变商品字典的选择状态
 * @param

 * @return { content: 列表, totalElements： 总数 }
 */
export const getSkuDictChange = (id: any): Promise<void> => {
    return server.Get(Api.skuDictChange + `/${id}`);
};
